Hệ thống quản lý phương tiện trong PHP
1 <?php
2 if(!isset($_SESSION))
3 {
4
5 session_start();
6 }
7
8 $username= $_GET['id'];
9 //echo $username;
10
11 $connection= mysqli_connect('localhost','root','','vehiclemanagement');
12
13 $query= "SELECT booking.booking_id, booking.req_date,booking.`ret_date`, booking.`destination`, booking.`veh_reg`, booking.`driverid`, tripcost.total_km,tripcost.oil_cost, tripcost.extra_cost,tripcost.total_cost,tripcost.paid FROM `booking` LEFT JOIN `tripcost` ON booking.username=tripcost.username WHERE booking.username='$username' AND booking.booking_id=tripcost.booking_id;";
14
15 //echo $query;
16
17 $result= mysqli_query($connection,$query);
18
19
20 ?>
21
22
23 <!DOCTYPE html>
24 <html lang="en">
25 <head>
26 <meta charset="UTF-8">
27 <title>Bill</title>
28
29 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
30 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
31 <script src="https://code.jquery.com/jquery-2.2.0.min.js" type="text/javascript"></script>
32 <script src="https://unpkg.com/scrollreveal/dist/scrollreveal.min.js"></script>
33 <link rel="stylesheet" type="text/css" href="./slick/slick.css">
34 <link rel="stylesheet" type="text/css" href="./slick/slick-theme.css">
35
36 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
37 <link rel="stylesheet" href="animate.css">
38 <link rel="stylesheet" href="style.css">
39 </head>
40 <body>
41 <?php include 'navbar.php'; ?>
42
43 <div class="container">
44 <div class="row">
45 <div class="page-header">
46 <h1 style="text-align: center;">My Bill</h1>
47 </div>
48 </div>
49
50
51 <div class="col-md-12">
52 <table class="table">
53 <thead>
54 <tr>
55 <th>Booking Id</th>
56 <th>Requested Date</th>
57 <th>Return Date</th>
58 <th>Destination</th>
59 <th>Vehicle Registration</th>
60 <th>Driver</th>
61 <th>Total Km</th>
62 <th>Oil Cost</th>
63 <th>Extra Cost</th>
64 <th>Total Cost</th>
65 <th>Paid</th>
66 </tr>
67 </thead>
68
69 <tbody>
70 <?php
71 while($row=mysqli_fetch_assoc($result)) {
72
73 ?>
74 <tr>
75 <td><?php echo $row['booking_id']; ?></td>
76 <td><?php echo $row['req_date']; ?></td>
77 <td><?php echo $row['ret_date']; ?></td>
78 <td><?php echo $row['destination']; ?></td>
79 <td><a href="busprofile.php?busid=<?php echo $row['veh_reg'] ?>"><?php echo $row['veh_reg'] ?></a></td>
80 <td><a href="driverprofile.php?driverid=<?php echo $row['driverid'] ?>"><?php echo $row['driverid'] ?></a></td>
81
82 <td><?php echo $row['total_km']; ?></td>
83 <td><?php echo $row['oil_cost']; ?></td>
84 <td><?php echo $row['extra_cost']; ?></td>
85 <td><?php echo $row['total_cost']; ?></td>
86
87 <?php if($row['paid']=='0'){ ?>
88 <td>No</td>
89 <?php } else { ?>
90 <td>Yes</td>
91 <?php } ?>
92 </tr>
93 </tbody>
94 <?php } ?>
95 </table>
96 </div>
97 </div>
98 </body>
99 </html>